// 导入api
import medicinalProductBaseApi from "@/api/medicinalproductbase";
// import productionAreaMockApi from "@/apitest/resourcemg";
import productbaseApi from "@/api/productbase";
// 导入from，即弹窗内容
import AddNew from "./form/addNewForm";
import EnvironmentForm from "./form/environmentForm";
import CompanyForm from "./form/companyForm";
import MdvalueForm from "./form/mdValueForm";
import { mapGetters } from 'vuex';
import VDistpicker from 'v-distpicker';
import VueElementLoading from 'vue-element-loading';
import { hasPermissionPoint } from "@/utils/permission"

// import {
//     BaiduMap,
//     BmScale,
//     BmNavigation,
//     BmOverviewMap,
//     BmCityList,
//     BmMarker,
//     BmControl,
//     BmView,
//     BmAutoComplete,
//     BmLocalSearch
// } from "vue-baidu-map";
import { cpus } from "os";

const BASEURL = "https://image.zysuyuan.cn:8031/";

// 基地面积
const baseArea = [
    { type: "1", name: "≥100亩", value: "100" },
    { type: "2", name: "≥500亩", value: "500" },
    { type: "3", name: "≥1000亩", value: "1000" },
    { type: "4", name: "≥5000亩", value: "5000" },
    { type: "5", name: "≥10000亩", value: "10000" }
];

// 总产量
const allProduction = [
    { type: "1", name: "≥100kg", value: "100" },
    { type: "2", name: "≥500kg", value: "500" },
    { type: "3", name: "≥1000kg", value: "1000" },
    { type: "4", name: "≥5000kg", value: "5000" },
    { type: "5", name: "≥10000kg", value: "10000" }
];

const components = {
    // BaiduMap,
    // BmScale,
    // BmNavigation,
    // BmOverviewMap,
    // BmCityList,
    // BmMarker,
    // BmControl,
    // BmView,
    // BmAutoComplete,
    // BmLocalSearch,
    // form
    AddNew, // 新增
    EnvironmentForm, // 生态环境
    CompanyForm,
    MdvalueForm,
    VDistpicker,
    VueElementLoading
};

const data = function () {
    return {
        enviroform: {
            bWaterEnvironment: "",
            bSoilEnvironment: "",
            bAirEnvironment: "",
            bTotalityAppraise: ""
        },
        companyform: {
            companyName: "",
            companyPosition: "",
            companyPerson: "",
            companyContact: "",
            companyMedicinal: "",
            companyRemarks: "",
        },
        mdValueform: {
            tMedicinalSharp: "", // 性状
            tMedicinalSharpImgPath: "",// 性状图片
            tMedicinalIdentify: "",// 鉴别
            tMedicinalIdentifyImgPath: "",// 鉴别图片
            tMedicinalExtractum: "",// 浸出物
            tMedicinalContentsCheck: "",// 含量测定
            tMedicinalFeatureImgPath: "",// 特征图谱或指纹图谱
            tMedicinalFeatureImgInfo: "",// 图谱说明
            tMedicinalQuality: ""// 总评
        },
        // 百度地图
        center: { lng: 0, lat: 0 },
        zoom: 3,
        // 调整装备
        locData: {
            ids: 0, //设置定位id
            longitude: "", //设置定位经度
            latitude: "" //设置定位纬度
        },
        // 标题
        title: "",
        radio: null,
        currentSelectItem: {},
        list: [],
        total: 0, //总记录数
        currentPage: 1, //当前页码
        pageSize: 5, // 每页显示10条数据
        searchMap: {
            id: "",
            page: "",
            size: "",
            bName: "",
            bArea: "",
            tYield: "",
            tMedicinalQuality: "",
            bInputLocation: "",
            bProvinceSeek: "", // 省
            bCitySeek: "", //市
            bRegionSeek: "", //区
            province: '',
            city: '',
            area: '',
        }, // 条件查询绑定的条件值
        // 省市区
        province: null,
        city: null,
        area: null,
        //payTypeOptions:payTypeOptions
        allProduction,
        baseArea,
        dialogFormAddNew: false, //新增表单
        locDialog: false, //gps弹窗
        dialogbaseArea: false, //基地照片弹窗
        dialogEnviroForm: false, //生态环境弹窗
        dialogCompanyForm: false, //公司详情弹窗
        dialogmedicineValue: false, //药材质量弹窗
        formLabelWidth: "120px",
        fit: "contain",
        fpojo: {
            id: "",
            tMedicinalId: "",   // 药材的id
            tProductBaseId: "", // 基地的id
            tEnvironment: "",   // 种植环境
            tCultivatedArea: "", //栽培面积
            tYield: "",  // 总产量
            tProportion: "",// 干鲜比
            tReportableArea: "",  //可采摘面积
            tPrice: "",  //该药材的价格流通
            tCollecteTime: "",  //采收时间
            tCollecteMethod: "",  //采摘防法
            tTotally: "",  // 净制
            tPart: "",  // 该药材的选取部分
            tProcess: "",  // 产地加工方法
            tScale: "",  // 分级与包装
            tSampleNum: "", // 取样量及编号
            tPlantNum: "",  // 植物标本编号
            tBreedMode: "",  // 种繁模式
            tFertilizeMethod: "",  // 施肥方式
            tPestsPrecaution: "",  // 病虫害防法
            tMedicinalQuality: "",  // 药材质量总评
            tMedicinalSharp: "",  // 药材性状
            tMedicinalIdentify: "",  // 药材鉴定
            tMedicinalExtractum: "",  // 药材浸出物
            tMedicinalContentsCheck: "", // 药材含量检测
            tMedicinalSharpImgPath: "",  // 该药材的性状图片的路径
            tMedicinalIdentifyImgPath: "",  // 该药材的药材鉴定图片的路径
            tMedicinalFeatureImgPath: "",  // 该药材的特征图谱或者是指纹图的路径
            tMedicinalFeatureImgInfo: "",  //该药材的特征图的说明
            tMedicinalSharpImgPathOut: "", // 该药材的性状图片的旧路径
            tMedicinalIdentifyImgPathOut: "", // 该药材的药材鉴定图片的旧路径
            tMedicinalFeatureImgPathOut: "", // 该药材的特征图谱或者是指纹图的旧路径
            tCreateTime: ""   // 创建时间
        }, //新增提交的数据
        // 查询参数
        // params: {
        //     id: "",
        //     page: "",
        //     size: "",
        //     bName: "",
        //     bPosition: "",
        //     bArea: "",
        //     tYield: "",
        //     tMedicinalQuality: "",
        //     bInputLocation: ""
        // },
        maplocation: {
            // 百度地图经纬度
            latitude: "", // 维度
            longitude: "" // 经度
        },
        imgs: [],    //基地照片
        isEdit: false, // 是否被编辑
        BASEURL,
        backup: {}
    };
};

const computed = {
    ...mapGetters([
        'name',
        'roles'
    ])
};

const methods = {
    changeStyle() {
        if (this.$route.name == 'productionarea') {
            return 'app-container';
        } else {
            return 'product-font'
        }
    },

    btnshow(point) {
        return hasPermissionPoint(point);
    },
    /*******************/
    // 增删查改
    fetchProductBase() {
        console.log(this.searchMap);
        console.log("当前页数" + this.currentPage);
        this.searchMap.id = localStorage.getItem("id");
        this.searchMap.page = this.currentPage;
        this.searchMap.size = this.pageSize;
        var vm = this.$store;
        vm.commit('updateLoading', true);
        console.log('是否开启加载', this.$store.state.elementloading.vueElementLoading)
        medicinalProductBaseApi.selectmBase(this.searchMap).then(resp => {
            this.list = resp.data.rows;
            console.log("查询成功:", resp.data);
            this.total = resp.data.total;
            if (resp.data.rows) {
                vm.commit('updateLoading', false);
                console.log('是否开启加载', this.$store.state.elementloading.vueElementLoading)
            }
        });
    },

    //提交新增数据
    //提交表单
    addData() {
        this.$refs.addnew.validataForm();
    },

    // 删除所选产地
    deleteMedicinalProductBase(id) {
        if (id != null && id != "") {
            this.$confirm("此操作将永久删除该生产基地信息, 是否继续?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    medicinalProductBaseApi.productBaseDelete(id).then(resp => {
                        if (resp.data.code == 0) {
                            this.$message({
                                message: "删除产地信息成功",
                                type: "success"
                            });
                            this.fetchProductBase();
                            this.radio = '';
                        } else {
                            this.$message({
                                message: "删除产地信息失败",
                                type: "warning"
                            });
                        }
                    });
                })
                .catch(() => {
                    this.$message({
                        type: "info",
                        message: "已取消删除"
                    });
                });
        } else {
            this.$message({
                message: "请选择需要删除的产地哦！",
                type: "warning"
            });
        }
    },

    /************************/
    // 操作表格
    // 点击一行
    chooseone(row) {
        this.radio = row.id;
        this.backup = this.fpojo = row;
        this.maplocation.latitude = row.bLatitude;
        this.maplocation.longitude = row.bLongitude;
    },
    handleSelectionChange(row) {
        console.log(row);
        this.currentSelectItem = row;
    },
    // 当每页显示条数改变后，被触发，val是最新的显示条数
    handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
        this.pageSize = val;
        this.fetchProductBase();
    },
    // 当页码改变后，被触发，val是最新的页码
    handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
        this.currentPage = val;
        this.fetchProductBase();
    },
    // 重置
    resetForm(formName) {
        console.log("重置", formName);
        // 重置回看 el-form-item 组件元素的prop 上是否指定了字段名，指定才会重置生效
        this.$refs[formName].resetFields();
    },


    /*************************/
    // 操作dialog弹窗
    // 弹出新增窗口
    handleAdd() {
        this.isEdit = false;
        this.opendialog(this.isEdit);
    },

    // 编辑
    handleEdit(id) {
        if (id != null && id != "") {
            this.isEdit = true; // 切换为修改模式
            this.opendialog(this.isEdit);
        } else {
            this.$message({
                message: "请选择需要修改的产地哦！",
                type: "warning"
            });
        }
        // this.title = "编辑生产基地";
        // console.log("编辑", row);
        // this.handleAdd();
        // this.fpojo = row;
    },

    // 打开窗口
    opendialog(e) {
        if (e) {
            this.fpojo = this.backup;
            console.log("back:", this.backup);
            this.title = "修改药材产地信息";
        } else {
            this.title = "新增药材产地信息";
            this.fpojo = {
                id: "",
                tMedicinalId: "",   // 药材的id
                tProductBaseId: "", // 基地的id
                tEnvironment: "",   // 种植环境
                tCultivatedArea: "", //栽培面积
                tYield: "",  // 总产量
                tProportion: "",// 干鲜比
                tReportableArea: "",  //可采摘面积
                tPrice: "",  //该药材的价格流通
                tCollecteTime: "",  //采收时间
                tCollecteMethod: "",  //采摘防法
                tTotally: "",  // 净制
                tPart: "",  // 该药材的选取部分
                tProcess: "",  // 产地加工方法
                tScale: "",  // 分级与包装
                tSampleNum: "", // 取样量及编号
                tPlantNum: "",  // 植物标本编号
                tBreedMode: "",  // 种繁模式
                tFertilizeMethod: "",  // 施肥方式
                tPestsPrecaution: "",  // 病虫害防法
                tMedicinalQuality: "",  // 药材质量总评
                tMedicinalSharp: "",  // 药材性状
                tMedicinalIdentify: "",  // 药材鉴定
                tMedicinalExtractum: "",  // 药材浸出物
                tMedicinalContentsCheck: "", // 药材含量检测
                tMedicinalSharpImgPath: "",  // 该药材的性状图片的路径
                tMedicinalIdentifyImgPath: "",  // 该药材的药材鉴定图片的路径
                tMedicinalFeatureImgPath: "",  // 该药材的特征图谱或者是指纹图的路径
                tMedicinalSharpImgPathOut: "", // 该药材的性状图片的旧路径
                tMedicinalIdentifyImgPathOut: "", // 该药材的药材鉴定图片的旧路径
                tMedicinalFeatureImgPathOut: "", // 该药材的特征图谱或者是指纹图的旧路径
                tMedicinalFeatureImgInfo: "",  //该药材的特征图的说明
            };
        }
        this.dialogFormAddNew = true;
        this.$nextTick(() => {
            this.$refs.addnew.cancelFieldValidate("addNewForm")
        })
    },

    // 关闭新增窗口
    closeAddNew() {
        this.dialogFormAddNew = false;
        this.fpojo = {
            id: "",
            tMedicinalId: "",   // 药材的id
            tProductBaseId: "", // 基地的id
            tEnvironment: "",   // 种植环境
            tCultivatedArea: "", //栽培面积
            tYield: "",  // 总产量
            tProportion: "",// 干鲜比
            tReportableArea: "",  //可采摘面积
            tPrice: "",  //该药材的价格流通
            tCollecteTime: "",  //采收时间
            tCollecteMethod: "",  //采摘防法
            tTotally: "",  // 净制
            tPart: "",  // 该药材的选取部分
            tProcess: "",  // 产地加工方法
            tScale: "",  // 分级与包装
            tSampleNum: "", // 取样量及编号
            tPlantNum: "",  // 植物标本编号
            tBreedMode: "",  // 种繁模式
            tFertilizeMethod: "",  // 施肥方式
            tPestsPrecaution: "",  // 病虫害防法
            tMedicinalQuality: "",  // 药材质量总评
            tMedicinalSharp: "",  // 药材性状
            tMedicinalIdentify: "",  // 药材鉴定
            tMedicinalExtractum: "",  // 药材浸出物
            tMedicinalContentsCheck: "", // 药材含量检测
            tMedicinalSharpImgPath: "",  // 该药材的性状图片的路径
            tMedicinalIdentifyImgPath: "",  // 该药材的药材鉴定图片的路径
            tMedicinalFeatureImgPath: "",  // 该药材的特征图谱或者是指纹图的路径
            tMedicinalFeatureImgInfo: "",  //该药材的特征图的说明
            tMedicinalSharpImgPathOut: "", // 该药材的性状图片的旧路径
            tMedicinalIdentifyImgPathOut: "", // 该药材的药材鉴定图片的旧路径
            tMedicinalFeatureImgPathOut: "", // 该药材的特征图谱或者是指纹图的旧路径
            tCreateTime: ""   // 创建时间
        };
    },
    // 清除新增窗口表单中的数据
    cleanAddNew() {
        this.fpojo = {
            id: "",
            tMedicinalId: "",   // 药材的id
            tProductBaseId: "", // 基地的id
            tEnvironment: "",   // 种植环境
            tCultivatedArea: "", //栽培面积
            tYield: "",  // 总产量
            tProportion: "",// 干鲜比
            tReportableArea: "",  //可采摘面积
            tPrice: "",  //该药材的价格流通
            tCollecteTime: "",  //采收时间
            tCollecteMethod: "",  //采摘防法
            tTotally: "",  // 净制
            tPart: "",  // 该药材的选取部分
            tProcess: "",  // 产地加工方法
            tScale: "",  // 分级与包装
            tSampleNum: "", // 取样量及编号
            tPlantNum: "",  // 植物标本编号
            tBreedMode: "",  // 种繁模式
            tFertilizeMethod: "",  // 施肥方式
            tPestsPrecaution: "",  // 病虫害防法
            tMedicinalQuality: "",  // 药材质量总评
            tMedicinalSharp: "",  // 药材性状
            tMedicinalIdentify: "",  // 药材鉴定
            tMedicinalExtractum: "",  // 药材浸出物
            tMedicinalContentsCheck: "", // 药材含量检测
            tMedicinalSharpImgPath: "",  // 该药材的性状图片的路径
            tMedicinalIdentifyImgPath: "",  // 该药材的药材鉴定图片的路径
            tMedicinalFeatureImgPath: "",  // 该药材的特征图谱或者是指纹图的路径
            tMedicinalSharpImgPathOut: "", // 该药材的性状图片的旧路径
            tMedicinalIdentifyImgPathOut: "", // 该药材的药材鉴定图片的旧路径
            tMedicinalFeatureImgPathOut: "", // 该药材的特征图谱或者是指纹图的旧路径
            tMedicinalFeatureImgInfo: "",  //该药材的特征图的说明
            tCreateTime: ""   // 创建时间
        };
    },

    //弹出gps窗口
    showgps(row) {
        // console.log(this.maplocation.longitude);
        // console.log(this.maplocation.latitude);
        console.log(row);
        // console.log(row.longitude);
        // console.log(row.latitude);
        // 这里不能使用this.maplocation对center的经纬度赋值，因为触发按钮时，this.maplocation的值还没变，还是上一次点击行赋的值
        // 这时候需要绑定行，即点击按钮时，获取当前行的数据，再将当前行的经纬度值赋值给center
        this.center.lng = row.bLongitude;
        this.center.lat = row.bLatitude;
        console.log("经度:" + this.center.lng);
        console.log("纬度:" + this.center.lat);
        this.locDialog = true;
        this.zoom = 15;
        this.$nextTick(() => {
            // this.zoom = 15;
        })
    },

    // 弹出生态环境
    openenvironment(row) {
        this.enviroform.bWaterEnvironment = row.bWaterEnvironment;
        this.enviroform.bSoilEnvironment = row.bSoilEnvironment;
        this.enviroform.bAirEnvironment = row.bAirEnvironment;
        this.enviroform.bTotalityAppraise = row.bTotalityAppraise;
        this.dialogEnviroForm = true;
    },

    // 弹出公司详情
    openCompany(row) {
        this.companyform.companyName = row.bCompanyName;
        this.companyform.companyPosition = row.bCompanyPosition;
        this.companyform.companyPerson = row.bCompanyPerson;
        this.companyform.companyContact = row.bCompanyContact;
        this.companyform.companyMedicinal = row.bCompanyMedicinal;
        this.companyform.companyRemarks = row.bCompanyRemarks;
        this.dialogCompanyForm = true;
    },

    // 弹出药品质量
    openmedicineValue(row) {
        this.mdValueform.tMedicinalSharp = row.tMedicinalSharp; // 性状
        this.mdValueform.tMedicinalSharpImgPath = row.tMedicinalSharpImgPath; // 性状图片
        this.mdValueform.tMedicinalIdentify = row.tMedicinalIdentify; // 鉴别
        this.mdValueform.tMedicinalIdentifyImgPath = row.tMedicinalIdentifyImgPath; // 鉴别图片
        this.mdValueform.tMedicinalExtractum = row.tMedicinalExtractum; // 浸出物
        this.mdValueform.tMedicinalContentsCheck = row.tMedicinalContentsCheck; // 含量测定
        this.mdValueform.tMedicinalFeatureImgPath = row.tMedicinalFeatureImgPath; // 特征图谱或指纹图谱
        this.mdValueform.tMedicinalFeatureImgInfo = row.tMedicinalFeatureImgInfo; // 图谱说明
        this.mdValueform.tMedicinalQuality = row.tMedicinalQuality;// 总评
        // 鉴定图片
        console.log(this.mdValueform.tMedicinalIdentifyImgPath)
        this.dialogmedicineValue = true;
    },
    // 百度地图方法
    // 当选择项发生变化时会触发该事件
    handleSelectionChange(val) {
        var i = 0;
        var valLen = val.length;

        if (valLen == 0) {
            this.locData.ids = 0;
        } else {
            for (i; i < valLen; i++) {
                if (i == 0) {
                    this.locData.ids = val[i].id;
                } else if (i > 0) {
                    this.locData.ids += "," + val[i].id;
                }
            }
        }
    },

    // 当某一行被点击时会触发该事件   参数：row, event, column
    getRowData(editEqu, event, column) {
        this.$refs.equTable.toggleRowSelection(editEqu);
    },

    // 设置定位弹出框
    setLoc(formName) {
        if (this.locData.ids == 0) {
            this.$message({
                message: "请选中装备后再设置定位",
                type: "warning"
            });
        } else {
            this.locDialog = true;
            map.clearOverlays();
        }
    },
    // 百度地图
    mapReady({ BMap, map }) {
        // this.center.lng = this.maplocation.longitude;
        // this.center.lat = this.maplocation.latitude;
        this.zoom = 15;
        window.map = map; //将map变量存储在全局
    },
    // 关闭百度地图
    closemapdialog() {
        // map.clearOverlays();
        this.locDialog = false;
    },
    // 地图点击事件
    getClickInfo(e) {
        map.clearOverlays();
        var myMarker = new BMap.Marker(new BMap.Point(e.point.lng, e.point.lat));
        map.addOverlay(myMarker);
        this.locData.longitude = e.point.lng;
        this.locData.latitude = e.point.lat;
    },
    // 设置定位确认
    locSubmit(formName) {
        if (this.locData.longitude == "") {
            addOper.$message({
                message: "请单击地图设置定位后再提交",
                type: "warning"
            });
        } else {
            //  向后台提交locData数据
        }
        this.locDialog = false;
    },
    // 设置定位取消
    locCancle(formName) {
        map.clearOverlays();
        this.locDialog = false;
    },
    // 查看基地照片
    openbasephoto(row) {
        console.log(row)
        var vm = this.$store;
        vm.commit('updateImgLoading', true);
        console.log('是否开启加载', this.$store.state.elementloading.imgLoading);
        productbaseApi.selectImgsList(row.tProductBaseId).then(resp => {
            this.imgs = resp.data.rows;
            if (resp.data.rows != null || resp.data.rows != undefined) {
                vm.commit('updateImgLoading', false);
                console.log('是否开启加载', this.$store.state.elementloading.imgLoading)
            }
            console.log(this.imgs);
        });
        this.dialogbaseArea = true;
    },
    // 关闭查看基地图片弹窗
    closeImgs() {
        this.imgs = [];
        this.dialogbaseArea = false;
    },

    handleChangeDis() {
        if (this.$route.name == 'productionarea' || this.$route.name == 'viewmessage') {
            let selectFirst = document.getElementById('distpicker-warpper');
            let selectAll = document.getElementById('distpicker-warpper').getElementsByTagName('select');
            // selectAll[1].style.color =  '#c0c4cc';
            for (var a = 0; a < selectAll.length; a++) {
                var selectEle = selectAll[a];
                selectEle.style.color = '#c0c4cc'; // 文字颜色
                // document.getElementById('select-dis').getElementsByTagName('select')[1][0].style.color = '#c0c4cc';
                // document.getElementById('select-dis').getElementsByTagName('select')[1][0].style.color = '#c0c4cc';
                selectEle.style.borderColor = '#d9d9d9'; // 边框颜色
            }
        }
    },
    // 获取省市区的值
    handleProvince(data) {
        // 修改选中文字颜色
        // document.getElementById('distpicker-warpper').getElementsByTagName('select')[0].style.color = '#606266';
        document.getElementById('select-dis').firstChild.style.color = '#606266';
        // 赋值给变量
        this.searchMap.bProvinceSeek = data.value.slice(0, data.value.length - 1);
        this.searchMap.province = data.value;
        if (this.searchMap.bProvinceSeek == '省') {
            this.searchMap.bProvinceSeek = "";
        }
        console.log("省：" + this.searchMap.bProvinceSeek);
    },
    handleCity(data) {
        // 修改选中文字颜色
        document.getElementById('select-dis').getElementsByTagName('select')[1].style.color = '#606266';
        // 赋值给变量
        this.searchMap.bCitySeek = data.value.slice(0, data.value.length - 1);
        this.searchMap.city = data.value;
        if (this.searchMap.bCitySeek == '市') {
            this.searchMap.bCitySeek = "";
        }
        console.log("市：" + this.searchMap.bCitySeek);
    },
    handleArea(data) {
        // 修改选中文字颜色
        document.getElementById('select-dis').getElementsByTagName('select')[2].style.color = '#606266';
        // 赋值给变量
        this.searchMap.bRegionSeek = data.value.slice(0, data.value.length - 1);
        this.searchMap.region = data.value;
        if (this.searchMap.bRegionSeek == '区') {
            this.searchMap.bRegionSeek = "";
        }
        console.log("区：" + this.searchMap.bRegionSeek);
    },
    onSelected(data) {
        if (data.province.code == undefined) {
            data.province.value = "";
        }
        if (data.city.code == undefined) {
            data.city.value = "";
        }
        if (data.area.code == undefined) {
            data.area.value = "";
        }
        // alert(data.province.value + ' | ' + data.city.value + ' | ' + data.area.value);
        console.log(data.province.value + ' | ' + data.city.value + ' | ' + data.area.value);
        console.log(data)
    },

    // 绑定查询按钮
    searchBase() {
        this.currentPage = 1;
        // console.log(this.searchMap);
        this.fetchProductBase();
    },
    // 重置
    reset() {
        this.searchMap = {}
    },

    // 跳转到原料去向
    toMedicinalGone(row) {
        // 存储药材id和基地id
        localStorage.setItem("tMedicinalId", row.tMedicinalId);
        localStorage.setItem("tProductBaseId", row.tProductBaseId);
        this.$router.push({
            name: 'medicinalgone'
        })
    }


};

function created() {
    // 初始化获取列表数据
    this.fetchProductBase();
    // this.radio = this.list[0].id;
};

function mounted() {
    setTimeout(() => {
        this.handleChangeDis();
    }, 10);
};

const watch = {
    // 监听相同路由下参数变化的时候，从而实现异步刷新
    $route(to, from) {
        // 做一些路由变化的响应
        this.fetchProductBase();
    }
};

export default {
    BASEURL,
    baseArea,
    allProduction,
    data,
    components,
    methods,
    created,
    watch,
    mounted,
    computed
}